home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
commodore-users-of-norman
/
CUON_07_(08-1984).d64
/
char editor
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
8KB
|
218 lines
86 REM *************************************
87 REM * *
88 REM * CREATED FOR *
89 REM * *
90 REM * THE COMMODORE EDUCATIONAL GROUP *
91 REM * *
92 REM * BY *
93 REM * *
94 REM * GARRY G. KIZIAK *
95 REM * *
96 REM * COPYRIGHT 1982 *
97 REM * *
98 REM *************************************
99 :
100 IF V=0 THEN GOSUB 1120
110 PRINT LEFT$(V$,7)TAB(18)LEFT$(BL$,9)
120 PRINT:PRINT TAB(18)LEFT$(BL$,16)
130 GOSUB 610:GOSUB 1160:GOSUB 620:GOSUB 860:GOSUB 650
140 FOR I=0 TO 7:P=PEEK(L+I):POKE Z+I,P:NEXT
150 GOSUB 570:X=0:Y=0:GOSUB 590
160 P=1148+X+Y*40:Q=PEEK(P):R=Q
170 R=(NOTRAND128)OR(NOT128ANDR)
180 POKE P,R
190 FOR I=1 TO 30:GET A$:IF A$="" THEN NEXT:GOTO 170
200 POKE P,Q
210 IF A$="" THEN X=(X+1)AND7:GOTO 160
220 IF A$="[157]" THEN X=(X-1)AND7:GOTO 160
230 IF A$="" THEN Y=(Y+1)AND7:GOTO 160
240 IF A$="[145]" THEN Y=(Y-1)AND7:GOTO 160
250 IF A$=DE$ THEN X=(X-1)AND7:P=1148+X+Y*40:POKE P,46:T=Z+Y
260 IF A$=DE$ THEN POKE T,PEEK(T)ANDH(X):GOTO 160
270 IF A$=" " THEN POKE P,46:T=Z+Y:POKE T,PEEK(T)ANDH(X):X=(X+1)AND7:GOTO 160
280 IF A$="." THEN POKE P,81:T=Z+Y:POKE T,PEEK(T)ORM(X):X=(X+1)AND7:GOTO 160
290 IF A$="[147]" THEN GOSUB 620:GOSUB 640:X=0:Y=0:GOTO 160
300 IF A$="Q" THEN GOSUB 620:GOSUB 640:DC=32:GOSUB 590:DC=255:GOSUB 650:GOTO 140
310 IF A$="" THEN X=0:Y=0:GOTO 160
320 IF A$=CR$ THEN X=0:Y=(Y+1)AND7:GOTO 160
330 IF A$="[133]" THEN FOR I=1 TO 7:POKE Z+I-1,PEEK(Z+I):NEXT:POKE Z+7,0:GOSUB 570
340 IF A$="[133]" THEN 160
350 IF A$="[134]" THEN FOR I=7 TO 1 STEP -1:POKE Z+I,PEEK(Z+I-1):NEXT:POKE Z,0
360 IF A$="[134]" THEN GOSUB 570:GOTO 160
370 IF A$="[135]" THEN FOR I=0 TO 7:POKE Z+I,(PEEK(Z+I)*2)AND255:NEXT
380 IF A$="[135]" THEN GOSUB 570:GOTO 160
390 IF A$="[136]" THEN FOR I=0 TO 7:POKE Z+I,(PEEK(Z+I)/2):NEXT
400 IF A$="[136]" THEN GOSUB 570:GOTO 160
410 IF A$="" THEN FOR I=0 TO 7:R=PEEK(Z+I):R=(NOTRAND255)OR(NOT255ANDR)
420 IF A$="" THEN POKE Z+I,R:NEXT:GOSUB 570:GOTO 160
430 IF A$="" THEN BG=(BG+1)AND15:POKE 53281,BG:GOTO 160
440 IF A$="" THEN BR=(BR+1)AND15:POKE 53280,BR:GOTO 160
450 IF A$="\" THEN GOSUB 580:GOSUB 570:GOTO 160
460 IF A$<>"" THEN 160
464 REM ****************************
465 REM * *
466 REM * ASSIGN CHARACTER BEING *
467 REM * EDITED TO A KEY *
468 REM * *
469 REM ****************************
470 PRINT " ASSIGN TO "
480 PRINT " WHICH "
490 PRINT " CHARACTER "
500 GOSUB 660
510 FOR I=0 TO 7:POKE L+I,PEEK(Z+I):NEXT:GOSUB 540
520 GOSUB 620:IF L<>Z THEN GOSUB 640
530 GOSUB 650:GOTO 140
540 PRINT " "
550 PRINT " "
560 PRINT " ":RETURN
565 REM ****************************
566 REM * *
567 REM * PRINT CHARACTER ON GRID *
568 REM * *
569 REM ****************************
570 FOR I=0 TO 7:POKE 925+I,PEEK(Z+I):NEXT:SYS 933:RETURN
575 REM ****************************
576 REM * *
577 REM * ROTATE EDIT CHARACTER *
578 REM * *
579 REM ****************************
580 HI=INT(Z/256):LO=Z-256*HI:POKE 251,LO:POKE 252,HI:SYS 896:RETURN
584 REM ****************************
585 REM * *
586 REM * PRINT EDIT CHARACTER *
587 REM * IN ALL 16 COLORS *
588 REM * *
589 REM ****************************
590 J=0:FOR I=0 TO 15:K=IAND7:IF K=0 THEN J=J+80
600 POKE CL+2*K+J+54272,I:POKE CL+2*K+J,DC:NEXT:RETURN
605 REM ****************************
606 REM * *
607 REM * CHANGE CHARACTER SET *
608 REM * *
609 REM ****************************
610 CB=CS*2048:Z=CB+255*8:POKE V+24,17+2*CS:RETURN
615 REM ****************************
616 REM * *
617 REM * PRINT GRID *
618 REM * *
619 REM ****************************
620 PRINT "[172][162][162][162][162][162][162][162][162][187][146]":FOR I=1 TO 8:PRINT "[161]........[161]":NEXT
630 PRINT "[188][146][162][162][162][162][162][162][162][162][190]":RETURN
635 REM ****************************
636 REM * *
637 REM * CLEAR EDIT CHARACTER *
638 REM * *
639 REM ****************************
640 FOR I=0 TO 7:POKE Z+I,0:NEXT:RETURN
644 REM ****************************
645 REM * *
646 REM * SELECT A CHARACTER *
647 REM * FOR EDITING *
648 REM * *
649 REM ****************************
650 POKE V+21,0:POKE V+16,0:Z1=0:POKE V,52:POKE V+1,166
660 R=0
670 R=1-R:POKE V+21,R
680 FOR I=1 TO 20:GET A$:IF A$="" THEN NEXT:GOTO 670
690 POKE V+21,1:A=VAL(A$):IF A>0 AND A<8THENCS=A:GOSUB610:POKE1570,CS+176:GOTO 670
700 IF A$="" THEN BG=(BG+1)AND15:POKE 53281,BG:GOTO 670
710 IF A$="" THEN BR=(BR+1)AND15:POKE 53280,BR:GOTO 670
720 IF A$="" THEN TT=(TT+1)AND3:GOSUB 860:GOTO 670
730 IF A$="Q" THEN POKE V+21,0:PRINT"[147]";:END
740 IF CS=2 OR CS=3 THEN 670
750 IF A$="" THEN Z1=(Z1+1)AND63
760 IF A$="[157]" THEN Z1=(Z1-1)AND63
770 IF A$="[145]" THEN Z1=(Z1-16)AND63
780 IF A$="" THEN Z1=(Z1+16)AND63
790 IF A$=CR$ THEN GOSUB 540:DC=32:GOSUB 590:DC=255:P=Z1+TT*64:L=CB+P*8:RETURN
800 IF A$="" THEN POKE V+21,0:GOSUB 880:GOTO 670
810 IF A$="S" THEN POKE V+21,0:GOSUB 970:GOTO 670
820 Y1=INT(Z1/16):X1=Z1-Y1*16:Y1=166+16*Y1:POKE V+21,0
830 IF X1<13 THEN X1=52+X1*16:FL=0:GOTO 850
840 IF X1>12 THEN X1=-12+(X1-12)*16:FL=1
850 POKE V+16,FL:POKE V,X1:POKE V+1,Y1:POKE V+21,1:GOTO 670
860 J=1548:FORI=0TO63:K=IAND15:IF K=0 THEN J=J+80
870 POKE 2*K+J,I+TT*64:NEXT:RETURN
875 REM ****************************
876 REM * *
877 REM * LOAD A CHARACTER SET *
878 REM * *
879 REM ****************************
880 PRINT "[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]"
890 PRINT " LOAD [146]"
900 PRINT " CHARACTER SET [146]"
910 LI=9:COL=18:LE=16:PRINT LEFT$(V$,7)TAB(18)"FILENAME:"
920 MSG$="[146][146]":GOSUB 1230:FL$="0:"+IN$
930 IF IN$="" THEN GOSUB 1160:PRINT LEFT$(V$,7)TAB(18)" ":RETURN
940 OPEN 1,8,15,"I0"
950 OPEN 2,8,0,FL$:GOSUB 1340:CLOSE2:CLOSE1
960 LOAD FL$,8,1
965 REM ****************************
966 REM * *
967 REM * SAVE A CHARACTER SET *
968 REM * *
969 REM ****************************
970 PRINT "[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]"
980 PRINT " SAVE [146]"
990 PRINT " CHARACTER SET [146]"
1000 LI=8:COL=18:LE=16:PRINT LEFT$(V$,6)TAB(18)"FILENAME:"
1010 MSG$="[146][146]":GOSUB 1230:FL$="0:"+IN$+",PRG,WRITE"
1020 IF IN$="" THEN GOSUB 1160:PRINT LEFT$(V$,7)TAB(18)" ":RETURN
1030 LI=11:COL=19:LE=1:MSG$="[146]SAVE TO SET?[146]":GOSUB 1230:TS=VAL(IN$)
1040 IF TS<1 OR TS=2 OR TS=3 OR TS>7 THEN 1030
1050 OPEN 1,8,15,"I0":GOSUB 1340
1060 OPEN 2,8,1,FL$:GOSUB 1340
1070 PRINT#2,CHR$(0);CHR$(8*TS);
1080 FOR I=0 TO 2047:PRINT#2,CHR$(PEEK(CB+I));:GOSUB 1340:NEXT:CLOSE2:CLOSE1
1090 PRINT LEFT$(V$,6)TAB(18)LEFT$(BL$,9):PRINT:PRINT TAB(18)LEFT$(BL$,16)
1100 PRINT LEFT$(V$,11)TAB(18)LEFT$(BL$,18):GOSUB 1160
1110 RETURN
1114 REM ****************************
1115 REM * *
1116 REM * INITIALIZE VARIABLES *
1117 REM * AND ENABLE CURSOR *
1118 REM * *
1119 REM ****************************
1120 POKE53281,1:PRINT "[147]":POKE53281,6:V=53248:CL=1024+5*40+18:DC=255:CS=1
1130 V$="":BL$=" "
1140 POKE 2040,13:POKE 53271,0:POKE 53277,0:DE$=CHR$(20):CR$=CHR$(13)
1150 FOR I=0 TO 7:M(I)=2^(7-I):H(I)=255-M(I):NEXT:RETURN
1155 REM ****************************
1156 REM * *
1157 REM * SCREEN DISPLAY *
1158 REM * *
1159 REM ****************************
1160 PRINT " [164][164][164][164][164][164][164][164][164][164][164] "
1170 PRINT " CHARACTER [146] "
1180 PRINT " EDITOR [146] "
1190 PRINT LEFT$(V$,13)TAB(11)"[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]"
1200 PRINT "[172][162][162][162][162][162][162][162][162] CHARACTER SET"CS"[157] [146][162][162][162][162][162][162][162][162][162]"
1210 FOR I=1 TO 9:PRINT "[161][161]":NEXT
1220 PRINT "[188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162]":RETURN
1225 REM ****************************
1226 REM * *
1227 REM * INPUT ROUTINE *
1228 REM * *
1229 REM ****************************
1230 Y9=2:IN$="":UC=0:UB$=LEFT$(BL$,LE):GOSUB 1330:UB$=" ":UC=3
1240 UT=TI
1250 GET Z9$:IF Z9$="" THEN 1310
1260 IF Z9$=CR$ THEN Y9=2:GOSUB 1330:PRINT "[157][157] ":RETURN
1270 IF Z9$=DE$ THEN ON -(LEN(IN$)=0) GOTO 1310:IN$=LEFT$(IN$,LEN(IN$)-1):GOTO1310
1280 IF (ASC(Z9$)AND127)<32 OR Z9$=CHR$(34) THEN 1310
1290 IF LE=LEN(IN$) THEN 1310
1300 IN$=IN$+Z9$
1310 GOSUB 1330:IF TI-UT<10 THEN 1250
1320 Y9=3-Y9:GOTO 1240
1330 PRINT LEFT$(V$,LI)TAB(COL-1)MID$(MSG$,Y9)UB$IN$MID$(" [146]",Y9,UC)" ";:RETURN
1335 REM ****************************
1336 REM * *
1337 REM * CHECK FOR DISK ERRORS *
1338 REM * *
1339 REM ****************************
1340 INPUT#1,A$,B$,C$,D$
1350 IF VAL(A$)=0 THEN RETURN
1360 PRINT"[147]DISK ERROR:[146] "B$
1370 CLOSE2
1380 END